package com.kitchen.ui.controls.friends.icon
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.geom.Point;
	import flash.geom.Rectangle;

	public class ListItemBg extends Sprite
	{
		private var bitmap:Bitmap;
		private var shape:Shape = null;
		private static var bitdata:BitmapData = null;
		public var h:Number;
		public var w:Number;
		
		public function ListItemBg(mainSkin:BitmapData)
		{
			super();
			this.layout(mainSkin);
		}
		
		private function layout(mainSkin:BitmapData):void{
			this.w = 145;
			this.h = 45;
			if(ListItemBg.bitdata == null){
				var rec:Rectangle = new Rectangle(645, 328, this.w*2, this.h);
				ListItemBg.bitdata = new BitmapData(this.w*2, this.h);
				ListItemBg.bitdata.copyPixels(mainSkin, rec, new Point());
			}
			this.bitmap = new Bitmap(ListItemBg.bitdata);
			this.addChild(this.bitmap);
			this.shape = new Shape();
			this.shape.graphics.beginFill(0xffffff, 1);
			this.shape.graphics.drawRect(0, 0, this.w,this.h);
			this.shape.graphics.endFill();
			this.mask = this.shape;
			this.addChild(this.shape);
		}
		
		public function focus():void{
			this.bitmap.x = -this.w+1;
		}
		
		public function unfocus():void{
			this.bitmap.x = 0;
		}
	}
}